<?php

include_once 'AFWebElement.class.php';

class AFWebDocument extends AFWebElement
{
	private $tree = NULL;
	private $parent = NULL;
	private $docId = NULL;

	public function __construct($id)
	{
//		$this->docId = md5($id);
		$this->docId = $id;
//		$this->tree = new DOMDocument('1.0', 'utf-8');//'<html/>');
//		$this->tree = new SimpleXMLElement('<html/>');// HTML>');// <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en-US">');
		parent::__construct('html');
//		$this->tree = array();
	}

	public function render($depth = 0)
	{
//		var_dump($this->tree->attributes());
/*		if(!$this->parent)	// This is a top-level page
		{
		}
		$a = new AFWebElement('asd');
		$a->color('red')->bgcolor('green')->html('Hello, world!');
//		$a->dump();
		echo $a->render();
		//return $this->tree->saveXML();*/

		$this->name = "html";

		// Check form
		$form = AF(FORMS)->getForm($this->docId);
		var_dump($form);

		return parent::render($depth = 0);
	}

/*	public function renderAsDocument()
	{
		$this->render();
	}*/
}

?>
